﻿@{
    Post post = ViewBag.Post;
    IList<Comment> comments = ViewBag.Comments;
}
<!--评论开始-->
<h3 id="comments">@post.Title 的评论：@(post.CommentCount > 0 ? "目前有 " + post.CommentCount + " 条留言" : "等着您坐沙发呢")</h3>
<ol class="commentlist">
    @foreach (var item in comments)
    {
        <li class="comment depth-1">
            <div class="comment-body">
                <div class="vcard">
                    <img alt="@item.AuthorName" src="@Html.GetGravatar(item.AuthorEmail, string.Empty, 40, "G")" class="avatar"><div class="floor"></div>
                    <strong><a href="javascript:;">@item.AuthorName</a></strong>:&nbsp;&nbsp;<a href="javascript:;" title="编辑评论">编辑</a>
                </div>
                <p>
                    @Html.Raw(item.AuthorName)
                </p>
                <div class="clear"></div>
                <span class="datetime">@item.PubDate.ToChsStr()</span><span class="reply"><a href="#respond">[回复]</a></span>
            </div>
        </li>
    }
</ol>
<div class="navigation">
    <div class="pagination"></div>
</div>
<div id="respond_box">
    <div id="respond">
        <h3>发表评论</h3>
        <div class="cancel-comment-reply">
            <div id="real_avatar">
                <img alt="gravatar" src="http://0.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=40" class="avatar avatar-40 photo avatar-default" height="40" width="40">
            </div>
        </div>
        <form action="/handlers/commentajax.ashx?action=publish_comment" method="post" id="commentform">
            <div id="comment-author-info">
                <p>
                    <input type="text" name="comment_author_name" id="comment_author_name" class="commenttext" value="" size="22" tabindex="1">
                    <label for="author">昵称 *</label>
                </p>
                <p>
                    <input type="text" name="comment_author_email" id="comment_author_email" class="commenttext" value="" size="22" tabindex="2">
                    <label for="email">邮箱 * <a id="gravatar_tips" title="查看如何申请一个自己的Gravatar全球通用头像" target="_blank" href="http://blog.wedn.net/post/apply-gravatar.html">（教你设置自己的个性头像）</a></label>
                </p>
                <p>
                    <input type="text" name="comment_author_url" id="comment_author_url" class="commenttext" value="" size="22" tabindex="3">
                    <label for="url">网址</label>
                </p>
            </div>
            <div class="clear"></div>
            <div>
                <textarea name="comment_content" id="comment_content" tabindex="4" cols="50" rows="5"></textarea><div id="loading" style="display: none;">正在提交, 请稍候...</div>
                <div id="error" style="display: none;">#</div>
            </div>
            <p>
                <input class="submit" name="submit" type="submit" id="submit" tabindex="5" value="提交留言">
                <input class="reset" name="reset" type="reset" id="reset" tabindex="6" value="重写">
                <input type="hidden" name="comment_post_id" value="@post.Id" id="comment_post_id">
                <input type="hidden" name="comment_parent_id" id="comment_parent_id" value="0">
            </p>
            <script type="text/javascript" src="/content/themes/default/js/realgravatar.js"></script>
            <script type="text/javascript">	//Crel+Enter
                //<![CDATA[
                jQuery(document).keypress(function (e) {
                    if (e.ctrlKey && e.which == 13 || e.which == 10) {
                        jQuery(".submit").click();
                        document.body.focus();
                    } else if (e.shiftKey && e.which == 13 || e.which == 10) {
                        jQuery(".submit").click();
                    }
                })
                // ]]>
            </script>
            <span style="padding: 0 0 2px 8px">快捷键：Ctrl+Enter</span>
        </form>
        <div class="clear"></div>
    </div>
</div>
<!--评论结束-->
